package com.gzy.cbrsystem.util;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.gzy.cbrsystem.insomnia.InsomniaBasicInfo;
import com.gzy.cbrsystem.insomnia.InsomniaBasicInfoDAO;
import com.gzy.cbrsystem.insomnia.util.InsomniaDAO;
import com.gzy.cbrsystem.insomnia.util.InsomniaUtil;

public class Search {
	String query;
	String caseType;
	InsomniaDAO insomniaDAO;
	
	public String getQuery() {
		return query;
	}

	public void setQuery(String query) {
		this.query = query;
	}

	public String getCaseType() {
		return caseType;
	}

	public void setCaseType(String caseType) {
		this.caseType = caseType;
	}

	public InsomniaDAO getInsomniaDAO() {
		return insomniaDAO;
	}

	public void setInsomniaDAO(InsomniaDAO insomniaDAO) {
		this.insomniaDAO = insomniaDAO;
	}
	public List<Item> showAll(String CaseType) {
		this.setCaseType(CaseType);
		
		if(this.getCaseType().equals("Insomnia")){
			InsomniaBasicInfoDAO iDAO=this.getInsomniaDAO().getInsomniaBasicInfoDAO();
			List<InsomniaBasicInfo> list=iDAO.findAll();
			
			List<Item> items=InsomniaUtil.InsomniaToItem(list);

			return items;
		}else {
			return null;
		}
	}
}
